{% extends "@admin/index.twig" %}

{% set title = 'Продукти' %}

{% block content %}
    <legend class='col-md-offset-1 col-md-10'>Продукти</legend>
    <br />
    <br />  
    {% if message is defined %}
        <div class="alert {{ message.type }}">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            {{ message.text }}
        </div>
    {% endif %}

    <a href="{{ path('admin_products_add') }}" class='btn btn-primary'><i class="glyphicon glyphicon-edit">&nbsp;</i>Добави</a>
    <a href="{{ path('admin_categories') }}" class='btn btn-default'><i class="glyphicon glyphicon-list">&nbsp;</i>Категории</a>

    <table class="table table-striped">
        <thead>
            <tr>
                <th>№</th>
                <th>Име</th>
{#                <th>Адрес</th>#}
                <th>Действие</th>
            </tr>
        </thead>
        <tbody>
            {% for Product in products %}
                <tr>
                    <td>{{ Product.id }}</td>
                    <td>{{ Product.name }}</td>
{#                    <td>{{ Product.url }}</td>#}
                    <td class="col-md-3">
                        <a href="{{ path('admin_products_edit', {'id': Product.id }) }}" class='btn alert-info'><i class="glyphicon glyphicon-edit">&nbsp;</i>Редактирай</a>
                        <a href="{{ path('admin_products_delete', {'id': Product.id}) }}" data-message="Сигурни ли сте че искате да изтриете този продукт?" class='confirm btn alert-danger'><i class="glyphicon glyphicon-remove">&nbsp;</i>Изтрий</a>
                    </td>
                </tr>
            {% endfor %}
        </tbody>
    </table>
{% endblock content %}